<script setup lang="ts">
import { ref } from 'vue'
import { genFileId, ElMessage } from 'element-plus'
import { useRouter } from "vue-router";
import AddProjectOperateBox from '/src/components/AddProjectOperateBox.vue'
import AddProjectOperateButton from '/src/components/AddProjectOperateButton.vue'
import SlotsAddProjectOpt from '/src/components/SlotsAddProjectOpt.vue'

const router = useRouter();
const loading = ref(false)
const loadingText = ref('Lodding...')
const opeateParam = {
    opeateText:'AI分析结果及进度动态展示：数据库名，查询结果，AI分析状态',
    opdateButtons:[
        {name:'下载AI分析结果', methond:'jsonCheck'},
        {name:'上传人工修订结果', methond:'warehouseQuery'},
        {name:'选择报告模板', methond:'jsonCheck'},
        {name:'生成尽调报告', methond:'reportCreate'}
    ]
};

const reportCreate = () => {
    loadingText.value = '正在生成尽调报告，请稍等...';
    // 开启loading
    loading.value = true;
    setTimeout(() => {
        // 关闭loading
        loading.value = false;
        ElMessage({
            message: '生成尽调报告成功!',
            type: 'success',
        })
        router.push('/addProject/reportUPdate')
    }, 2000);
}
</script>

<template>
    <SlotsAddProjectOpt
        :loading="loading"
        :loadingText="loadingText"
    >
        <div class="w-100" >
            <!-- 操作区文本框 -->
            <AddProjectOperateBox :opeateText="opeateParam.opeateText"/>
            <!-- 操作区按钮组 -->
            <AddProjectOperateButton :opdateButtons="opeateParam.opdateButtons"
                @reportCreate="reportCreate"/>
        </div>
    </SlotsAddProjectOpt>
</template>

<style scoped></style>
